package com.cal.utms.valuation;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.List;

import com.cal.utms.entity.Deal;
import com.cal.utms.entity.Instrument;
import com.cal.utms.entity.InstrumentCouponDate;
import com.cal.utms.entity.InstrumentType;
import com.cal.utms.enumType.InterestRate;
import com.cal.utms.enumType.InterestType;

/**
 * Method Naming Convention 
 * Interest Rate 	Interest Type 	Coupon Availability 	Withholding Tax 
 * Fixed-f			Straight-s    	No-n 					No-n
 * Floating-v		Discounted-d	Yes-y					Upfront-u
 * 															Maturity-m
 */
public class PurchaseCalculator {

	private double prvalBeforeWhtd;
	private double prvalAfterWhtd;
	private double actualRate;
	private double couponRate;
	private Date purchaseDate;
	private Date maturityDate;
	private Date valuationDate;
	private int dayCount = 365;

	private double effectiveRate;
	private int daysinInterest;
	private double accruedInterest;
	private double couponInterest;
	private double dailyInterest;
	private int tenor;
	private double costPlusMarketValue;
	private double faceValue;
	private double withholdingTax;

	public double valuateMaturityValue(Deal deal) {
		Instrument instrument = null;
		if (deal.getDealInstrumentMaps() == null) {
			System.out.println("Error:DayEnd:Cannot find Deal Instrument Map for Purchase: " + deal.getDealCode());
			return -1;
		} else if (deal.getDealInstrumentMaps().size() == 0) {
			System.out.println("Error:DayEnd:Cannot find the instrument for purchase: " + deal.getDealCode());
			return -1;
		} else if (deal.getDealInstrumentMaps().size() == 1) {
			instrument = deal.getDealInstrumentMaps().get(0).getInstrument();
		} else {
			instrument = deal.getDealInstrumentMaps().get(0).getInstrument();
			System.out.println("Warning:DayEnd: More than one instruments have bound to purchase:" + deal.getDealCode());
		}

		InstrumentType insType = instrument.getInstrumentType();
		if (insType == null) {
			System.out.println("Error:DayEnd:Cannot find the InstrumentType for purchase: " + deal.getDealCode() + " for Instrument: " + instrument.getInstrumentCode());
			return -1;
		}
		if (deal.getDayBasis().equals("Act / 360")) {
			dayCount = 360;
		} else if (deal.getDayBasis().equals("Act / 364")) {
			dayCount = 364;
		} else if (deal.getDayBasis().equals("30 / 360")) {
			dayCount = 360;
		}
		double dealValue = deal.getDealValue().doubleValue();
		double rate = deal.getActualRate().doubleValue();
		String wht = deal.getWithholdingTax();
		double whtRate = 0;
		double couponRate = 0;
		if (deal.getWithholdingTaxRate() != null) {
			whtRate = deal.getWithholdingTaxRate().doubleValue();
		}
		purchaseDate = deal.getValueDate();
		maturityDate = deal.getMaturityDate();

		if (insType.getInterestRate() == InterestRate.F && insType.getInterestType() == InterestType.S && insType.getCouponAvailability() == 0 && wht.equals("No")) {
			System.out.println("FSNN" + dealValue + ":" + rate + ":" + purchaseDate + ":" + valuationDate + ":" + dayCount);
			valuateCpaFaceValueFsnn(dealValue, rate, purchaseDate, maturityDate, dayCount);
		} else if (insType.getInterestRate() == InterestRate.F && insType.getInterestType() == InterestType.S && insType.getCouponAvailability() == 0 && wht.equals("Upfront")) {
			System.out.println("FSNU" + dealValue + ":" + rate + ":" + purchaseDate + ":" + valuationDate + ":" + dayCount);
			valuateCpaFaceValueFsnu(dealValue, rate, purchaseDate, maturityDate, dayCount, whtRate);
		} else if (insType.getInterestRate() == InterestRate.F && insType.getInterestType() == InterestType.S && insType.getCouponAvailability() == 0 && wht.equals("Maturity")) {
			System.out.println("FSNM" + dealValue + ":" + rate + ":" + purchaseDate + ":" + valuationDate + ":" + dayCount);
			valuateCpaFaceValueFsnm(dealValue, rate, purchaseDate, maturityDate, dayCount, whtRate);
		} else if (insType.getInterestRate() == InterestRate.F && insType.getInterestType() == InterestType.S && insType.getCouponAvailability() == 1 && wht.equals("No")) {
			System.out.println("FSY1N" + dealValue + ":" + rate + ":" + purchaseDate + ":" + valuationDate + ":" + dayCount);
			if (instrument.getCouponRate() == null) {
				System.out.println("Cannot Find Coupon Rate for Instrument : " + instrument.getInstrumentCode());
			} else {
				couponRate = instrument.getCouponRate().doubleValue();
			}
			valuateCpaFaceValueFsyn(dealValue, rate, couponRate, purchaseDate, maturityDate, dayCount);
		} else if (insType.getInterestRate() == InterestRate.F && insType.getInterestType() == InterestType.S && insType.getCouponAvailability() == 2 && wht.equals("No")) {
			System.out.println("FSY2N" + dealValue + ":" + rate + ":" + purchaseDate + ":" + valuationDate + ":" + dayCount);
			if (instrument.getCouponRate() == null) {
				System.out.println("Cannot Find Coupon Rate for Instrument : " + instrument.getInstrumentCode());
			} else {
				couponRate = instrument.getCouponRate().doubleValue();
			}
			valuateCpaFaceValueFsyn(dealValue, rate, couponRate, purchaseDate, maturityDate, dayCount);
		} else {
			System.out.println("FSNN" + dealValue + ":" + rate + ":" + purchaseDate + ":" + valuationDate + ":" + dayCount);
			System.out.println("Calculation not available for the deals with :" + insType.getInterestRate() + " intereset Rate, " + insType.getInterestType() + " Intereset Type, "
					+ insType.getCouponAvailability() + " Coupons and " + wht + " Withholding Tax!!!");
			System.out.println("Calculation Method not defined for the Purchase Deal :" + deal.getDealCode());
			valuateCpaFaceValueFsnn(dealValue, rate, purchaseDate, maturityDate, dayCount);
		}
		return faceValue;
	}

	public void valuateEodParams(Deal deal, Date valueDate) {
		Instrument instrument = null;
		if (deal.getDealInstrumentMaps() == null) {
			System.out.println("Error:DayEnd:Cannot find Deal Instrument Map for Purchase: " + deal.getDealCode());
			return;
		} else if (deal.getDealInstrumentMaps().size() == 0) {
			System.out.println("Error:DayEnd:Cannot find the instrument for purchase: " + deal.getDealCode());
			return;
		} else if (deal.getDealInstrumentMaps().size() == 1) {
			instrument = deal.getDealInstrumentMaps().get(0).getInstrument();
		} else {
			instrument = deal.getDealInstrumentMaps().get(0).getInstrument();
			System.out.println("Warning:DayEnd: More than one instruments have bound to purchase:" + deal.getDealCode());
		}

		InstrumentType insType = instrument.getInstrumentType();
		if (insType == null) {
			System.out.println("Error:DayEnd:Cannot find the InstrumentType for purchase: " + deal.getDealCode() + " for Instrument: " + instrument.getInstrumentCode());
			return;
		}
		if (deal.getDayBasis().equals("Act / 360")) {
			dayCount = 360;
		} else if (deal.getDayBasis().equals("Act / 364")) {
			dayCount = 364;
		} else if (deal.getDayBasis().equals("30 / 360")) {
			dayCount = 360;
		}
		double dealValue = deal.getDealValue().doubleValue();
		double rate = deal.getActualRate().doubleValue();
		String wht = deal.getWithholdingTax();
		double whtRate = 0;
		double couponRate = 0;
		if (deal.getWithholdingTaxRate() != null) {
			whtRate = deal.getWithholdingTaxRate().doubleValue();
		}
		purchaseDate = deal.getValueDate();
		maturityDate = deal.getMaturityDate();
		valuationDate = valueDate;

		if (insType.getInterestRate() == InterestRate.F && insType.getInterestType() == InterestType.S && insType.getCouponAvailability() == 0 && wht.equals("No")) {
			System.out.println("FSNN" + dealValue + ":" + rate + ":" + purchaseDate + ":" + valuationDate + ":" + dayCount);
			valuateCpaMarketValueFsnn(dealValue, rate, purchaseDate, valuationDate, dayCount);
		} else if (insType.getInterestRate() == InterestRate.F && insType.getInterestType() == InterestType.S && insType.getCouponAvailability() == 0 && wht.equals("Upfront")) {
			System.out.println("FSNU" + dealValue + ":" + rate + ":" + purchaseDate + ":" + valuationDate + ":" + dayCount);
			valuateCpaMarketValueFsnu(dealValue, rate, purchaseDate, maturityDate, valuationDate, dayCount, whtRate);
		} else if (insType.getInterestRate() == InterestRate.F && insType.getInterestType() == InterestType.S && insType.getCouponAvailability() == 0 && wht.equals("Maturity")) {
			System.out.println("FSNM" + dealValue + ":" + rate + ":" + purchaseDate + ":" + valuationDate + ":" + dayCount);
			valuateCpaMarketValueFsnm(dealValue, rate, purchaseDate, valuationDate, dayCount);
		} else if (insType.getInterestRate() == InterestRate.F && insType.getInterestType() == InterestType.S && insType.getCouponAvailability() == 1 && wht.equals("No")) {
			System.out.println("FSY1N" + dealValue + ":" + rate + ":" + purchaseDate + ":" + valuationDate + ":" + dayCount);
			if (instrument.getCouponRate() == null) {
				System.out.println("Cannot Find Coupon Rate for Instrument : " + instrument.getInstrumentCode());
			} else {
				couponRate = instrument.getCouponRate().doubleValue();
			}
			valuateCpaMarketValueFsyn(dealValue, rate, couponRate, purchaseDate, valuationDate, dayCount, instrument);
		} else if (insType.getInterestRate() == InterestRate.F && insType.getInterestType() == InterestType.S && insType.getCouponAvailability() == 2 && wht.equals("No")) {
			System.out.println("FSY2N" + dealValue + ":" + rate + ":" + purchaseDate + ":" + valuationDate + ":" + dayCount);
			if (instrument.getCouponRate() == null) {
				System.out.println("Cannot Find Coupon Rate for Instrument : " + instrument.getInstrumentCode());
			} else {
				couponRate = instrument.getCouponRate().doubleValue();
			}
			valuateCpaMarketValueFsyn(dealValue, rate, couponRate, purchaseDate, valuationDate, dayCount, instrument);
		} else {
			System.out.println("FSNN" + dealValue + ":" + rate + ":" + purchaseDate + ":" + valuationDate + ":" + dayCount);
			System.out.println("Calculation not available for the deals with :" + insType.getInterestRate() + " intereset Rate, " + insType.getInterestType() + " Intereset Type, "
					+ insType.getCouponAvailability() + " Coupons and " + wht + " Withholding Tax!!!");
			System.out.println("Calculation Method not defined for the Purchase Deal :" + deal.getDealCode());
			valuateCpaMarketValueFsnn(dealValue, rate, purchaseDate, valuationDate, dayCount);
		}
	}

	public void valuateCpaMarketValueFsnn(double prvalBeforeWhtd, double actualRate, Date purchaseDate, Date valuationDate, int dayCount) {
		this.prvalBeforeWhtd = prvalBeforeWhtd;
		this.actualRate = actualRate;
		this.purchaseDate = purchaseDate;
		this.valuationDate = valuationDate;
		this.dayCount = dayCount;
		this.effectiveRate = actualRate; // Since WHT is 0
		this.prvalAfterWhtd = this.prvalBeforeWhtd;
		daysinInterest = ((int) ((valuationDate.getTime() - purchaseDate.getTime()) / (1000 * 60 * 60 * 24))) + 1;
		accruedInterest = prvalBeforeWhtd * (effectiveRate / 100) * (((double) daysinInterest) / ((double) dayCount));
		costPlusMarketValue = this.prvalBeforeWhtd + accruedInterest;
		dailyInterest = prvalBeforeWhtd * (effectiveRate / 100) / dayCount;
	}

	public void valuateCpaFaceValueFsnn(double prvalBeforeWhtd, double actualRate, Date purchaseDate, Date maturityDate, int dayCount) {
		this.prvalBeforeWhtd = prvalBeforeWhtd;
		this.actualRate = actualRate;
		this.purchaseDate = purchaseDate;
		this.maturityDate = maturityDate;
		this.dayCount = dayCount;
		this.effectiveRate = actualRate; // Since WHT is 0
		this.prvalAfterWhtd = this.prvalBeforeWhtd;
		tenor = (int) ((maturityDate.getTime() - purchaseDate.getTime()) / (1000 * 60 * 60 * 24));
		accruedInterest = prvalBeforeWhtd * (effectiveRate / 100) * (((double) tenor) / ((double) dayCount));
		faceValue = this.prvalBeforeWhtd + accruedInterest;
		dailyInterest = prvalBeforeWhtd * (effectiveRate / 100) / dayCount;
	}

	public void valuateCpaDealValueFsnn(double faceValue, double actualRate, Date purchaseDate, Date maturityDate, int dayCount) {
		this.faceValue = faceValue;
		this.actualRate = actualRate;
		this.purchaseDate = purchaseDate;
		this.maturityDate = maturityDate;
		this.dayCount = dayCount;
		this.effectiveRate = actualRate; // Since WHT is 0
		this.prvalAfterWhtd = this.prvalBeforeWhtd;
		tenor = (int) ((maturityDate.getTime() - purchaseDate.getTime()) / (1000 * 60 * 60 * 24));
		// accruedInterest = prvalBeforeWhtd * (effectiveRate / 100) *
		// (((double) tenor) / ((double) dayCount));
		// faceValue = this.prvalBeforeWhtd + accruedInterest;
		prvalBeforeWhtd = faceValue / (((effectiveRate / 100) * (((double) tenor) / ((double) dayCount)) + 1));
		dailyInterest = prvalBeforeWhtd * (effectiveRate / 100) / dayCount;
	}

	public void valuateCpaMarketValueFsnu(double prvalBeforeWhtd, double actualRate, Date purchaseDate, Date maturityDate, Date valuationDate, int dayCount, double wht) {
		this.prvalBeforeWhtd = prvalBeforeWhtd;
		this.actualRate = actualRate;
		this.purchaseDate = purchaseDate;
		this.maturityDate = maturityDate;
		this.dayCount = dayCount;
		// this.prvalAfterWhtd = this.prvalBeforeWhtd;
		tenor = (int) ((maturityDate.getTime() - purchaseDate.getTime()) / (1000 * 60 * 60 * 24));
		this.faceValue = ((1 + (actualRate / 100) * (((double) tenor) / dayCount)) / (1 + (actualRate / 100) * (((double) tenor) / dayCount) * (wht / 100))) * prvalBeforeWhtd;
		this.effectiveRate = (((faceValue - prvalBeforeWhtd) / prvalBeforeWhtd) * (((double) dayCount) / tenor)) * 100;
		daysinInterest = ((int) ((valuationDate.getTime() - purchaseDate.getTime()) / (1000 * 60 * 60 * 24))) + 1;
		accruedInterest = prvalBeforeWhtd * (effectiveRate / 100) * (((double) daysinInterest) / ((double) dayCount));
		costPlusMarketValue = this.prvalBeforeWhtd + accruedInterest;
		dailyInterest = prvalBeforeWhtd * (effectiveRate / 100) / dayCount;
	}

	public void valuateCpaFaceValueFsnu(double prvalBeforeWhtd, double actualRate, Date purchaseDate, Date maturityDate, int dayCount, double wht) {
		this.prvalBeforeWhtd = prvalBeforeWhtd;
		this.actualRate = actualRate;
		this.purchaseDate = purchaseDate;
		this.maturityDate = maturityDate;
		this.dayCount = dayCount;
		// this.prvalAfterWhtd = this.prvalBeforeWhtd;
		tenor = (int) ((maturityDate.getTime() - purchaseDate.getTime()) / (1000 * 60 * 60 * 24));
		this.faceValue = ((1 + (actualRate / 100) * (((double) tenor) / dayCount)) / (1 + (actualRate / 100) * (((double) tenor) / dayCount) * (wht / 100))) * prvalBeforeWhtd;
		this.effectiveRate = (((faceValue - prvalBeforeWhtd) / prvalBeforeWhtd) * (((double) dayCount) / tenor)) * 100;
		dailyInterest = prvalBeforeWhtd * (effectiveRate / 100) / dayCount;
	}

	public void valuateCpaMarketValueFsnm(double prvalBeforeWhtd, double actualRate, Date purchaseDate, Date valuationDate, int dayCount) {
		this.prvalBeforeWhtd = prvalBeforeWhtd;
		this.actualRate = actualRate;
		this.purchaseDate = purchaseDate;
		this.valuationDate = valuationDate;
		this.dayCount = dayCount;
		this.effectiveRate = actualRate; // Since WHT is 0
		// this.prvalAfterWhtd = this.prvalBeforeWhtd;
		daysinInterest = ((int) ((valuationDate.getTime() - purchaseDate.getTime()) / (1000 * 60 * 60 * 24))) + 1;
		accruedInterest = prvalBeforeWhtd * (effectiveRate / 100) * (((double) daysinInterest) / ((double) dayCount));
		costPlusMarketValue = this.prvalBeforeWhtd + accruedInterest;
		dailyInterest = prvalBeforeWhtd * (effectiveRate / 100) / dayCount;
	}

	public void valuateCpaFaceValueFsnm(double prvalBeforeWhtd, double actualRate, Date purchaseDate, Date maturityDate, int dayCount, double wht) {
		this.prvalBeforeWhtd = prvalBeforeWhtd;
		this.actualRate = actualRate;
		this.purchaseDate = purchaseDate;
		this.maturityDate = maturityDate;
		this.dayCount = dayCount;
		// TODO this.prvalAfterWhtd = this.prvalBeforeWhtd;
		tenor = (int) ((maturityDate.getTime() - purchaseDate.getTime()) / (1000 * 60 * 60 * 24));
		// TODO accruedInterest = prvalBeforeWhtd * (effectiveRate/100) *
		// (((double)tenor)/((double)dayCount));
		withholdingTax = prvalBeforeWhtd * (actualRate / 100) * ((double) tenor / dayCount) * (wht / 100);
		faceValue = prvalBeforeWhtd + prvalBeforeWhtd * (actualRate / 100) * ((double) tenor / dayCount) * (1 - (wht / 100));
		this.effectiveRate = (((faceValue - prvalBeforeWhtd) / prvalBeforeWhtd) * (((double) dayCount) / tenor)) * 100;
		dailyInterest = prvalBeforeWhtd * (effectiveRate / 100) / dayCount;
	}

	public void valuateCpaFaceValueFsyn(double prvalBeforeWhtd, double actualRate, double couponRate, Date purchaseDate, Date maturityDate, int dayCount) {
		this.prvalBeforeWhtd = prvalBeforeWhtd;
		this.actualRate = actualRate;
		this.purchaseDate = purchaseDate;
		this.maturityDate = maturityDate;
		this.dayCount = dayCount;
		this.prvalAfterWhtd = this.prvalBeforeWhtd;
		tenor = (int) ((maturityDate.getTime() - purchaseDate.getTime()) / (1000 * 60 * 60 * 24));
		accruedInterest = prvalBeforeWhtd * (actualRate / 100) * (((double) tenor) / ((double) dayCount));
		faceValue = this.prvalBeforeWhtd + accruedInterest;

		double accruedCouponInterest = faceValue * (couponRate / 100) * (((double) tenor) / ((double) dayCount));
		double totalFaceValue = faceValue + accruedCouponInterest;
		effectiveRate = ((totalFaceValue - prvalBeforeWhtd) / prvalBeforeWhtd) * (((double) dayCount) / ((double) tenor)) * 100;
		dailyInterest = prvalBeforeWhtd * (effectiveRate / 100) / dayCount;
	}

	public void valuateCpaMarketValueFsyn(double prvalBeforeWhtd, double actualRate, double couponRate, Date purchaseDate, Date valuationDate, int dayCount, Instrument instrument) {
		valuateCpaFaceValueFsyn(prvalBeforeWhtd, actualRate, couponRate, purchaseDate, instrument.getMaturityDate(), dayCount);

		this.valuationDate = valuationDate;
		this.prvalAfterWhtd = this.prvalBeforeWhtd;
		daysinInterest = ((int) ((valuationDate.getTime() - purchaseDate.getTime()) / (1000 * 60 * 60 * 24))) + 1;
		accruedInterest = prvalBeforeWhtd * (actualRate / 100) * (((double) daysinInterest) / ((double) dayCount));
		Date lastCouponDate = getLastCouponDate(instrument, valuationDate);
		int daysinCoupon = ((int) ((valuationDate.getTime() - lastCouponDate.getTime()) / (1000 * 60 * 60 * 24))) + 1;
		couponInterest = faceValue * (couponRate / 100) * (((double) daysinCoupon) / ((double) dayCount));
		costPlusMarketValue = this.prvalBeforeWhtd + accruedInterest + couponInterest;
	}

	public Date getLastCouponDate(Instrument instrument, Date valueDate) {
		Date couponDate = instrument.getIssueDate();
		if (instrument.getInstrumentType() == null || instrument.getInstrumentType().getCouponAvailability() == 0)
			return null;

		List<Date> couponDateList = new ArrayList<Date>();
		couponDateList.add(instrument.getIssueDate());
		if (instrument.getInstrumentType().getCouponAvailability() == 2 && instrument.getInstrumentCouponDates() != null) {
			for (InstrumentCouponDate icd : instrument.getInstrumentCouponDates()) {
				couponDateList.add(icd.getCouponDate());
			}
		} else if (instrument.getInstrumentType().getCouponAvailability() == 1 && instrument.getCouponFreq() > 0) {
			Calendar c = Calendar.getInstance();
			c.setTime(instrument.getMaturityDate());
			while (c.getTime().compareTo(instrument.getIssueDate()) >= 0) {
				System.out.println(c.getTime());
				couponDateList.add(c.getTime());
				c.add(Calendar.MONTH, instrument.getCouponFreq() * (-1));
			}
		}
		Collections.sort(couponDateList, new Comparator<Date>() {
			@Override
			public int compare(Date arg0, Date arg1) {
				return arg1.compareTo(arg0);
			}
		});
		for (Date d : couponDateList) {
			if (d.compareTo(valueDate) < 0) {
				couponDate = d;
				break;
			}
		}
		return couponDate;
	}

	public Date getNextCouponDate(Instrument instrument, Date valueDate) {
		Date couponDate = null;
		if (instrument.getInstrumentType() == null || instrument.getInstrumentType().getCouponAvailability() == 0)
			return null;

		List<Date> couponDateList = new ArrayList<Date>();
		if (instrument.getInstrumentType().getCouponAvailability() == 2 && instrument.getInstrumentCouponDates() != null) {
			for (InstrumentCouponDate icd : instrument.getInstrumentCouponDates()) {
				couponDateList.add(icd.getCouponDate());
			}
		} else if (instrument.getInstrumentType().getCouponAvailability() == 1 && instrument.getCouponFreq() > 0) {
			Calendar c = Calendar.getInstance();
			c.setTime(instrument.getMaturityDate());
			while (c.getTime().compareTo(instrument.getIssueDate()) >= 0) {
				couponDateList.add(c.getTime());
				c.add(Calendar.MONTH, instrument.getCouponFreq() * (-1));
			}
		}
		Collections.sort(couponDateList);
		for (Date d : couponDateList) {
			if (d.compareTo(valueDate) > 0) {
				couponDate = d;
				break;
			}
		}
		return couponDate;
	}

	public static double getCouponValueForEod(Instrument instrument, Date valueDate) {
		double couponValue = 0;

		return couponValue;
	}

	public static void main(String[] args) throws ParseException {
		String purDateStr = "01-05-2012";
		String valDateStr = "01-05-2021";
		DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");
		Date purchaseDate = dateFormat.parse(purDateStr);
		Date valuationDate = dateFormat.parse(valDateStr);
		PurchaseCalculator p = new PurchaseCalculator();
		/*
		 * p.valuateCpaMarketValueFsnn(62800000.0, 5.85, purchaseDate,
		 * valuationDate, 365);
		 */
		p.valuateCpaFaceValueFsyn(452000.0000, 5.00, 9.00, purchaseDate, valuationDate, 365);
		System.out.println("Days In Interest::" + p.getTenor());
		System.out.println(p.getAccruedInterest());
		System.out.println("Accrued Interest::" + p.getFaceValue());
	}

	public int getDayCount() {
		return dayCount;
	}

	public Date getValuationDate() {
		return valuationDate;
	}

	public void setValuationDate(Date valuationDate) {
		this.valuationDate = valuationDate;
	}

	public void setDayCount(int dayCount) {
		this.dayCount = dayCount;
	}

	public Date getPurchaseDate() {
		return purchaseDate;
	}

	public void setPurchaseDate(Date purchaseDate) {
		this.purchaseDate = purchaseDate;
	}

	public Date getMaturityDate() {
		return maturityDate;
	}

	public void setMaturityDate(Date maturityDate) {
		this.maturityDate = maturityDate;
	}

	public double getActualRate() {
		return actualRate;
	}

	public void setActualRate(double actualRate) {
		this.actualRate = actualRate;
	}

	public double getEffectiveRate() {
		return effectiveRate;
	}

	public void setEffectiveRate(double netRate) {
		this.effectiveRate = netRate;
	}

	public int getDaysinInterest() {
		return daysinInterest;
	}

	public void setDaysinInterest(int daysinInterest) {
		this.daysinInterest = daysinInterest;
	}

	public double getPrvalBeforeWhtd() {
		return prvalBeforeWhtd;
	}

	public void setPrvalBeforeWhtd(double prvalBeforeWhtd) {
		this.prvalBeforeWhtd = prvalBeforeWhtd;
	}

	public double getPrvalAfterWhtd() {
		return prvalAfterWhtd;
	}

	public void setPrvalAfterWhtd(double prvalAfterWhtd) {
		this.prvalAfterWhtd = prvalAfterWhtd;
	}

	public double getAccruedInterest() {
		return accruedInterest;
	}

	public void setAccruedInterest(double accruedInterest) {
		this.accruedInterest = accruedInterest;
	}

	public int getTenor() {
		return tenor;
	}

	public void setTenor(int tenor) {
		this.tenor = tenor;
	}

	public double getCostPlusMarketValue() {
		return costPlusMarketValue;
	}

	public void setCostPlusMarketValue(double costPlusMarketValue) {
		this.costPlusMarketValue = costPlusMarketValue;
	}

	public double getWithholdingTax() {
		return withholdingTax;
	}

	public void setWithholdingTax(double withholdingTax) {
		this.withholdingTax = withholdingTax;
	}

	public double getFaceValue() {
		return faceValue;
	}

	public void setFaceValue(double faceValue) {
		this.faceValue = faceValue;
	}

	public double getDailyInterest() {
		return dailyInterest;
	}

	public void setDailyInterest(double dailyInterest) {
		this.dailyInterest = dailyInterest;
	}

	public double getCouponRate() {
		return couponRate;
	}

	public void setCouponRate(double couponRate) {
		this.couponRate = couponRate;
	}

	public double getCouponInterest() {
		return couponInterest;
	}

	public void setCouponInterest(double couponInterest) {
		this.couponInterest = couponInterest;
	}

}
